using System.Data;
using ET;

namespace DAL
{
    public class Job_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Job(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Job_Search");
        }
        public DataTable BindGirdtb_JobDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Job_ID", id);
            return cls.GetData("sp_tb_Job_Detail");
        }
        #endregion

        #region Insert
        public bool Inserttb_Job(Job_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Job_Alias", data.Job_Alias);
            cls.AddParameter("@Job_Name", data.Job_Name);
            cls.AddParameter("@Job_Note", data.Job_Note);
            cls.AddParameter("@Job_User_Add", data.Job_User_Add);
            cls.AddParameter("@Job_Date_Add", data.Job_Date_Add);
            cls.AddParameter("@Job_Computer_Add", data.Job_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Job_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Job(Job_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Job_ID", data.Job_ID);
            cls.AddParameter("@Job_Alias", data.Job_Alias);
            cls.AddParameter("@Job_Name", data.Job_Name);
            cls.AddParameter("@Job_Note", data.Job_Note);
            cls.AddParameter("@Job_User_Modify", data.Job_User_Modify);
            cls.AddParameter("@Job_Date_Modify", data.Job_Date_Modify);
            cls.AddParameter("@Job_Computer_Modify", data.Job_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Job_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Job(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Job_Id", id);
            cls.ExecuteNonQuery("sp_tb_Job_Delete");
            return true;
        }
        #endregion
    }
}